home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #2 / Monster Media No. 2 (Monster Media)(1994).ISO / modem / tlxtw202.zip / HANGUP.SLT < prev    next >
Text File  |  1994-05-05  |  4KB  |  122 lines

  1. // hangup.slt
  2. // see lines 13 and 37
  3. int     flag = 0, statline, statline_color, h, i, Len, x, y;
  4. str     bbsname[15],  c[64];
  5. ///////////////////////////////////////////////////////////////////////////////
  6. main()
  7. {
  8.   if(cinp_cnt())
  9.       flushbuf();
  10.  _scr_chk_key = 0;
  11.  _back_color = 0;
  12.  _fore_color = 7;
  13. _script_dir = "C:\TELIX\WORK\SLC\";                                          //
  14.  //////////////////////////////////////////////////////////////////////////////
  15.  i = keyload("telix.key");                         // reload default .key file
  16.  if ( i != -1 ) printsc("^M^JTelix.key loaded." );
  17.  printsc("^M^JScript directory:  ");
  18.  printsc( _script_dir );
  19.  prints("");
  20.  update_term();
  21.  newdir(_telix_dir);
  22.  x=getx(); y=gety();
  23.  if (!chk_stat(0))
  24.    chk_stat(24);
  25.  pstraxy("                                                      │", 0, statline, statline_color);
  26.  gotoxy(x,y);
  27.  if ( capture_stat() == 1 || capture_stat() == 2 ) {
  28.      subchrs(_capture_fname, 0, strlen(_capture_fname), c); strcat(c, " closed");
  29.      Len = 40 - strlen(c) / 2 ;
  30.      capture ( "*close*" );
  31.      h = vsavearea(Len - 4, 15, Len + strlen(c) + 3, 17);
  32.      box(Len - 4, 15, Len + strlen(c) + 3, 17, 3 ,0 ,31);
  33.      pstraxy( c, Len, 16, 30);
  34.  }
  35. ///////////////////////////////////////////////////////////////////////////////
  36. // reset default capture file name
  37. _capture_fname = "D:\CAP";                                                   //
  38. ///////////////////////////////////////////////////////////////////////////////
  39.  if ( carrier() ) {
  40.    i=0;
  41.    while( i == 0 && inkey() != 27 ) {
  42.      i=hangup();
  43.      if(i > 0) break;
  44.      vrstrarea(h);  gotoxy( 0, y );
  45.      delay_scr(10);
  46.      cputs_tr(_mdm_hang_str);
  47.      if (waitfor("OK", 3) ) break;
  48.      delay_scr(5);
  49.    }
  50.  }
  51.  vrstrarea(h);
  52.  pstraxy( _entry_name, 0, statline, statline_color);
  53.  gotoxy(0, y);
  54.  while ( inkey() != 27 ) {
  55.    cputs_tr(_mdm_init_str);
  56.    if ( waitfor("OK", 2 )) break;
  57.    delay_scr(2);
  58.  }
  59.  cursor_onoff(1);
  60.  clean_tempdir();
  61.  _scr_chk_key = 1;
  62.  return 1;
  63. }
  64. ///////////////////////////////////////////////////////////////////////////////
  65. //                  Check Row and Color of Status Line
  66. chk_stat ( int statchk )
  67. {
  68.   gotoxy(67, statchk);
  69.   if ((vgetchr() & 255) == 79 ) {
  70.     Statline = statchk;
  71.     statline_color = vgetchr()/256;
  72.     return 1;
  73.   }
  74.  else return 0;
  75. }
  76. ///////////////////////////////////////////////////////////////////////////////
  77. clean_tempdir()//delete unwanted files in the temp directory
  78. {
  79.     str tempdir[64],buf[64];
  80.     int f;
  81.  
  82.     if(!getenv("temp",tempdir)) {
  83.         soft_wind("^"Temp^" Environment variable not found!",30);
  84.         return 0;
  85.     }
  86.     newdir(tempdir);
  87.     fdelete("Entrynam.txt");
  88.     // add any more files here
  89.     newdir(_telix_dir);
  90.     return 1;
  91. }
  92. ///////////////////////////////////////////////////////////////////////////////
  93. append_backslash( str string )
  94. {
  95.     if(subchr(string,strlen(string)-1)!='\')strcat(string,"\");
  96.     return string;
  97. }
  98. /////////////////////////////////////////////////////////////////////////////
  99. //                         Soft Wind
  100. soft_wind(str message, int duration)
  101. {
  102.     int old_chk_key;
  103.     old_chk_key = _scr_chk_key;
  104.     _scr_chk_key = 0;
  105.     int l, h, x, y, key = 0, ts;
  106.     cursor_onoff(0);
  107.     x=getx(); y=gety();
  108.     l = strlen(message)/2;
  109.     h = vsavearea(37-l, 10, 43+l, 14);
  110.     box(37-l, 10, 43+l, 14, 3, 0, 5 );
  111.     pstraxy(message, 40-l  , 12, 11 );
  112.     ts = timer_start(duration);
  113.     while( !key && !time_up(ts)) key=inkey();
  114.     vrstrarea(h);
  115.     cursor_onoff(1);
  116.     gotoxy(x,y);
  117.     timer_free(ts);
  118.     _scr_chk_key = old_chk_key;
  119.     return key;
  120. }
  121. //////////////////////////////////////////////////////////////////////////////
  122.